package br.ufrgs.tcp.maps;

import java.util.ArrayList;

import android.content.Context;
import android.graphics.drawable.Drawable;

import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.OverlayItem;

@SuppressWarnings("rawtypes")
public abstract class AbstractItemizedOverlay extends ItemizedOverlay {

	protected ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
	protected Context mContext;
	
	public AbstractItemizedOverlay(Drawable defaultMarker) {
		 super(boundCenterBottom(defaultMarker));
	}
	public AbstractItemizedOverlay(Drawable defaultMarker, Context context) {
		super(boundCenterBottom(defaultMarker));
		  mContext = context;
	}
		
	
	@Override
	protected OverlayItem createItem(int arg0) {
		return mOverlays.get(arg0);
	}

	public void addOverlayItem(OverlayItem overlay) {
	    mOverlays.add(overlay);
	    populate();
	}
	
	@Override
	public int size() {
		return mOverlays.size();
	}

}
